/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Merlion.MRP.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;


@Entity
public class ProductionFloorEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date mfgDate;
    
    @OneToMany
    Collection<ProductionLineEntity> productionLines;

    public ProductionFloorEntity() {
    }

    public ProductionFloorEntity(Date mfgDate, ProductionLineEntity line1, ProductionLineEntity line2) {
        this.mfgDate = mfgDate;
              
        List<ProductionLineEntity> lines = new ArrayList();
        lines.add(line1);
        lines.add(line2);
        
        this.productionLines = lines;
    }
    
    
    
    public Date getMfgDate() {
        return mfgDate;
    }

    public void setMfgDate(Date mfgDate) {
        this.mfgDate = mfgDate;
    }

    public Collection<ProductionLineEntity> getProductionLines() {
        return productionLines;
    }

    public void setProductionLines(Collection<ProductionLineEntity> productionLines) {
        this.productionLines = productionLines;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ProductionFloorEntity other = (ProductionFloorEntity) obj;
        if (this.mfgDate != other.mfgDate && (this.mfgDate == null || !this.mfgDate.equals(other.mfgDate))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 83 * hash + (this.mfgDate != null ? this.mfgDate.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "ProductionFloorEntity{" + "mfgDate=" + mfgDate + '}';
    }

    
}
